<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>侦听器</title>
</head>
<body>
    <div id='app'>
        <input type="text" v-model='msg'>
        <h3>{{msg}}</h3>
    </div>
    <script src='vue.js'></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                msg:'',
            },
            watch:{
                // key是属于data对象的属性名 value:监视后的行为   newV：新的值   oldV:旧的值
                'msg':function(newV,oldV){
                    if(newV==='100'){
                        console.log('hello');
                    }
                }
            }
        })
    </script>
</body>
</html>